import { defineStore } from 'pinia';

type StateType = {
	userPermissions: string[],
	userRole: string[]
}


export const usePermissionStore = defineStore('permission', {
	state: () => {
		return {
			userPermissions: ['1', '2', '3'],
			userRole: ['administrator','admin']
		};
	},
	actions: {
		/**
		 * 更新所有state
		 * @param datas 
		 */
		handleSetState(datas: StateType) {
			let key:keyof StateType
			for (key in datas) {
				this[key] = datas[key]
			}
		},
	}
});
